@import 'base';
@import 'reset';

body {
  font-family: sans-serif;
  font-size: $base-font-size;
  line-height: $base-line-height;
  background: $gray;
  margin-bottom: rhythm(1);
}

a {
  color: $black;
}

.inline-icon {
  svg {
    margin-right: rhythm(1/4);
    width: 1em;
    height: 1em;
    vertical-align: middle;
    background: transparent;
  }
}

h1 {
  @include adjust-font-size-to(48px, 2);
}

ul.inline-list {
  @include adjust-font-size-to(14px, 2/3);
  @include clearfix;

  li {
    list-style-type: none;
    display: inline-block;
    white-space: nowrap;

    &::after {
      content: '//';
      padding: 0 rhythm(1/4);
    }

    &:last-child::after {
      content: '';
    }
  }
}

.svg-container {
  min-width: 200px;

  &.loading .svg {
    position: absolute;
    top: -10000px;
  }
}

header {
  background: $green;
  background: linear-gradient(to bottom, $green 0%, $dark-green 100%);
  padding: rhythm(1);
  @include box-shadow;
  @include clearfix;

  .logo {
    display: inline-block;

    span {
      color: $gray;
    }
  }

  h1 {
    font-family: 'Bangers', 'cursive';
  }

  nav {
    @include adjust-font-size-to(18px, 1);
    display: inline-block;
    margin-left: rhythm(1/4);
    padding-left: rhythm(1/4);
  }

  a {
    text-decoration: inherit;

    &:active, &:focus {
      text-decoration: underline;
    }
  }
}

#content {
  padding: rhythm(1);
  display: block;

  .copy {
    background-color: $tan;
    padding: rhythm(1/2);
  }

  .changelog {
    dt {
      font-weight: bold;
    }

    dd {
      &::before {
        content: '\00BB';
        font-weight: bold;
        margin-right: rhythm(1/2);
      }
    }
  }

  .error {
    overflow: hidden;

    h1 {
      @include adjust-font-size-to($base-font-size * 2);
      font-weight: bold;
      float: left;
    }

    blockquote {
      background-color: $green;
      position: relative;
      padding: rhythm(1);
      display: inline-block;
      font-style: italic;
      float: right;

      &::before {
        @include adjust-font-size-to($base-font-size * 4);
        content: '\201c';
        position: absolute;
        left: 0;
        top: 0;
        font-style: normal;
      }

      &::after {
        @include adjust-font-size-to($base-font-size * 4);
        content: '\201d';
        position: absolute;
        right: 0;
        bottom: -0.5em;
        font-style: normal;
      }
    }

    p {
      clear: left;
    }
  }

  .documentation {
    h1 {
      @include adjust-font-size-to($base-font-size * 2);
      font-weight: bold;
    }

    h2 {
      @include adjust-font-size-to($base-font-size);
      font-weight: bold;
    }

    h3 {
      @include adjust-font-size-to($base-font-size);

      &::before {
        content: '\00BB';
        font-weight: bold;
        margin-right: rhythm(1/4);
      }
    }

    h1, h2, h3 {
      clear: both;
    }

    h2, h3 {
      margin-bottom: rhythm(1);
    }

    section, div.section {
      margin: rhythm(1) 0;
      overflow: hidden;
    }

    p {
      margin: rhythm(1) 0;
    }

    figure {
      line-height: 0;
      background: $white;
      margin: rhythm(1/4);
      @include box-shadow;

      &.shift-right {
        float: right;
        margin-left: rhythm(1/2);
      }

      &.shift-left {
        float: left;
        margin-right: rhythm(1/2);
      }

      .svg {
        margin: 0;
        text-align: center;
      }

      figcaption {
        @include adjust-font-size-to($base-font-size);
        background: $green;
        font-weight: bold;
        padding: 0 rhythm(1/4);
      }
    }
  }

  .test-results {
      display: none;
      background: $white;
      margin-top: rhythm(1);
      padding: 7px;
  }

  .test-error {
      margin-top: rhythm(1);
      background: #b3151a;
      color: #fff;
  }

  .tests {
      margin-top: 15px;
      label {
          margin-right: 10px;
      }
  }
  .application, .tests {
    color:white;
    font-weight: bold;
    position: relative;
    @include clearfix;

    form {
      overflow: hidden;
    }

    textarea {
      @include adjust-font-size-to($base-font-size);
      border: 0 none;
      outline: none;
      background: $tan;
      padding: 0 0.5em;
      margin-bottom: 0.25em;
      width: 100% !important; // "!important" prevents user changing width
      box-sizing: border-box;
      font-family:Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace;

      @include input-placeholder {
        color: $gray;
      }
    }

    button {
      @include adjust-font-size-to($base-font-size);
      width: 100px;
      border: 0 none;
      background: $green;
      color: white;
      font-weight: bold;
      background: linear-gradient(to bottom, $green 0%, $dark-green 100%);
      float: left;
      cursor: pointer;
    }

    ul {
      float: right;
      display: none;

      body.has-results & {
        display: inline-block;
      }

      &.hide-download-png.hide-permalink .download-svg:after,
      &.hide-permalink .download-png:after {
        display: none;
      }

      &.hide-permalink .permalink,
      &.hide-download-svg .download-svg,
      &.hide-download-png .download-png {
        display: none;
      }
    }
  }

  .results {
    margin-top: rhythm(1);
    display: none;

    body.has-results &, body.has-error &, body.is-loading & {
      display: block;
    }
  }
}

.progress {
  width: 50%;
  height: rhythm(1/2);
  border: 1px solid $dark-green;
  overflow: hidden;
  margin: rhythm(1) auto;

  div {
    background: $green;
    background: linear-gradient(135deg, $green 25%, $light-green 25%, $light-green 50%, $green 50%, $green 75%, $light-green 75%, $light-green 100%);
    background-size: rhythm(2) rhythm(2);
    background-repeat: repeat-x;
    height: 100%;
    animation: progress 1s infinite linear
  }
}

@keyframes progress {
  0% { background-position-x: rhythm(2); }
  100% { background-position-x: 0; }
}

#error {
  background: $red;
  color: $white;
  padding: 0 0.5em;
  white-space: pre;
  font-family: monospace;
  font-weight: bold;
  display: none;
  overflow-x: auto;

  body.has-error & {
    display: block;
  }
}

#warnings {
  @include adjust-font-size-to($base-font-size, 1);
  font-weight: bold;
  background-color: $yellow;
  display: none;

  li {
    margin: rhythm(1/4);
  }

  body.has-results & {
    display: block;
  }
}

#regexp-render {
  background: $white;
  width: 100%;
  overflow: auto;
  text-align: center;
  display: none;

  body.is-loading &,
  body.has-results & {
    display: block;
  }
}

#open-iconic {
  display: none;

  path {
    stroke: none;
    fill-opacity: 1;
  }
}

footer {
  padding: 0 rhythm(1);

  img {
    vertical-align: middle;
    width: 80px;
    height: 15px;
  }
}
